﻿using System;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using Misuzilla.Crigate;

namespace Misuzilla.Crigate.Contexts
{
    [Description("システムに関連するコンテキストに切り替えます")]
    public class SystemContext : Context
    {
        [Description("バージョン情報を表示します")]
        public void Version()
        {
            Assembly asm = typeof(Server).Assembly;
            AssemblyName asmName = asm.GetName();
            Console.NotifyMessage(String.Format("Crigate {0}", asmName.Version));
        }

        [Description("システム情報を表示します")]
        public void ShowInfo()
        {
            Assembly asm = typeof(Server).Assembly;
            AssemblyName asmName = asm.GetName();

            Console.NotifyMessage("[Core]");
            Console.NotifyMessage(String.Format("Crigate {0}", asmName.Version));
            Console.NotifyMessage(String.Format("Location: {0}", asm.Location));
            Console.NotifyMessage(String.Format("BaseDirectory: {0}", Path.GetDirectoryName(typeof(Server).Assembly.Location)));

            Console.NotifyMessage("[System]");
            Console.NotifyMessage(String.Format("Operating System: {0}", Environment.OSVersion));
            Console.NotifyMessage(String.Format("Runtime Version: {0}", Environment.Version));

            Console.NotifyMessage("[Session]");
            Console.NotifyMessage(String.Format("ConfigDirectory: {0}", CurrentSession.UserConfigDirectory));
        }
    }
}
